import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/dist/index.css'
import './assets/styles/reset.css'
import './assets/styles/border.css'
import installIcons from '@/icons'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import hasPerms from '@/directives/permission'

const app = createApp(App)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 注册svg-icon组件
installIcons(app)

// 注册权限指令
app.directive('hasPerms', hasPerms)

app.use(store)
app.use(router)
app.use(ElementPlus, { locale: zhCn })
app.mount('#app')
